home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mntsox46.zoo / patch / falcon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-14  |  20.5 KB  |  663 lines

  1. /*
  2.  * GNU-C Bindings for Falcon XBIOS functions
  3.  * -- hyc 11-9-92 (uunet!hanauma.Jpl.Nasa.Gov!hyc)
  4.  */
  5.  
  6. #ifndef _FALCON_H
  7. #define _FALCON_H
  8.  
  9. #ifndef _OSBIND_H
  10. #include <osbind.h>
  11. #endif
  12.  
  13. #ifdef __LATTICE__
  14.  
  15. #define __F_TRAP {register d2,a2; "4e4e";}
  16.  
  17. void _vfv(int);
  18. char _bfv(int);
  19. short _sfv(int);
  20. long _lfv(int);
  21.  
  22. void _vfs(int, int);
  23. short _sfs(int, int);
  24. long _lfs(int, int);
  25.  
  26. void _vfss(int, int, int);
  27. long _lfss(int, int, int);
  28. void _vfll(int, long, long);
  29. void _vflp(int, long, void *);
  30.  
  31. void _vfssr(int, int, int, long *);
  32. void _vfssR(int, int, int, const long *);
  33. void _vfpls(int, void *, long, int);
  34. short _sflsp(int, long, int, void *);
  35. short _sfpls(int, void *, long, int);
  36. long _lfspp(int, int, void *, void *);
  37.  
  38. short _sfppss(int, void *, void *, int, int);
  39. void _vfllpp(int, long, long, void *, void *);
  40. void _vfplll(int, void *, long, long, long);
  41. void _vfplpl(int, void *, long, void *, long);
  42.  
  43. long _lfsssss(int, int, int, int, int, int);
  44.  
  45. void _vfppllll(int, void *, void *, long, long, long, long);
  46.  
  47.  
  48. #pragma inline _vfv((short))    __F_TRAP
  49. #pragma inline d0=_bfv((short))    __F_TRAP
  50. #pragma inline d0=_sfv((short))    __F_TRAP
  51. #pragma inline d0=_lfv((short))    __F_TRAP
  52.  
  53. #pragma inline _vfs((short),(short))    __F_TRAP
  54. #pragma inline d0=_sfs((short),(short))    __F_TRAP
  55. #pragma inline d0=_lfs((short),(short))    __F_TRAP
  56.  
  57. #pragma inline _vfss((short),(short),(short))    __F_TRAP
  58. #pragma inline d0=_lfss((short),(short),(short))    __F_TRAP
  59. #pragma inline _vfll((short),,)    __F_TRAP
  60. #pragma inline _vflp((short),,)    __F_TRAP
  61.  
  62. #pragma inline _vfssr((short),(short),(short),)    __F_TRAP
  63. #pragma inline _vfssR((short),(short),(short),)    __F_TRAP
  64. #pragma inline _vfpls((short),,,(short))    __F_TRAP
  65. #pragma inline d0=_sfpls((short),,,(short))    __F_TRAP
  66. #pragma inline d0=_sflsp((short),,(short),)    __F_TRAP
  67. #pragma inline d0=_lfspp((short),(short),,)    __F_TRAP
  68.  
  69. #pragma inline d0=_sfppss((short),,,(short),(short))    __F_TRAP
  70. #pragma inline _vfllpp((short),,,,)    __F_TRAP
  71. #pragma inline _vfplll((short),,,,)    __F_TRAP
  72. #pragma inline _vfplpl((short),,,,)    __F_TRAP
  73.  
  74. #pragma inline d0=_lfsssss((short),(short),(short),(short),(short),(short))    __F_TRAP
  75.  
  76. #pragma inline _vfppllll((short),,,,,)    __F_TRAP
  77.  
  78. #else /* !__LATTICE__ */
  79.  
  80. #ifdef __C68__
  81. #define trap_14_wwwwww    _trap_14_wwwwww
  82. #define trap_14_wllll    _trap_14_wllll
  83. #define trap_14_wllllll    _trap_14_wllllll
  84. #define trap_14_wll    _trap_14_wll
  85. #define trap_14_wlwl    _trap_14_wlwl
  86. __EXTERN long trap_14_wwwwww __PROTO((short, short, short, short, short,
  87.                       short));
  88. __EXTERN long trap_14_wllll __PROTO((short, long, long, long, long));
  89. __EXTERN long trap_14_wllllll __PROTO((short, long, long, long, long,
  90.                        long, long));
  91. __EXTERN long trap_14_wll __PROTO((short, long, long));
  92. __EXTERN long trap_14_wlwl __PROTO((short, long, short, long));
  93.  
  94. #else /* !__C68__ */
  95.  
  96. #ifdef __SOZOBON__
  97. #define trap_14_wwwwww    xbios
  98. #define trap_14_wllll    xbios
  99. #define trap_14_wllllll    xbios
  100. #define trap_14_wll    xbios
  101. #define trap_14_wlwl    xbios
  102.  
  103. #else /* !__SOZOBON__ */
  104.  
  105. #ifndef trap_14_wwwwww
  106. #if __GNUC__ > 1
  107. #define trap_14_wwwwww(n,a,b,c,d,e)                    \
  108. __extension__                                \
  109. ({                                    \
  110.     register long retvalue __asm__("d0");                \
  111.     short _a = (short)(a);                        \
  112.     short _b = (short)(b);                        \
  113.     short _c = (short)(c);                        \
  114.     short _d = (short)(d);                        \
  115.     short _e = (short)(e);                        \
  116.                                     \
  117.     __asm__ volatile                        \
  118.     ("\
  119.         movw    %6,sp@-; \
  120.         movw    %5,sp@-; \
  121.         movw    %4,sp@-; \
  122.         movw    %3,sp@-; \
  123.         movw    %2,sp@-; \
  124.         movw    %1,sp@-; \
  125.         trap    #14; \
  126.         lea    sp@(12),sp"                    \
  127.     : "=r"(retvalue)                        \
  128.     : "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e)        \
  129.     : "d0", "d1", "d2", "a0", "a1", "a2", "memory");        \
  130.     retvalue;                            \
  131. })
  132. #else
  133. #define trap_14_wwwwww(n,a,b,c,d,e)                    \
  134. ({                                    \
  135.     register long retvalue __asm__("d0");                \
  136.     short _a = (short)(a);                        \
  137.     short _b = (short)(b);                        \
  138.     short _c = (short)(c);                        \
  139.     short _d = (short)(d);                        \
  140.     short _e = (short)(e);                        \
  141.                                     \
  142.     __asm__ volatile                        \
  143.     ("\
  144.         movw    %4,sp@-; \
  145.         movw    %3,sp@-; \
  146.         movw    %2,sp@-; \
  147.         movw    %1,sp@-; \
  148.         movw    %0,sp@- "                    \
  149.     :: "r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e));        \
  150.                                     \
  151.     __asm__ volatile                        \
  152.     ("\
  153.         movw    %1,sp@-; \
  154.         trap    #14; \
  155.         lea    sp@(12),sp"                    \
  156.     : "=r"(retvalue)                        \
  157.     : "g"(n)                            \
  158.     : "d0", "d1", "d2", "a0", "a1", "a2");                \
  159.     retvalue;                            \
  160. })
  161. #endif
  162. #endif
  163.  
  164. #ifndef trap_14_wllll
  165. #define trap_14_wllll(n,a,b,c,d)                    \
  166. __extension__                                \
  167. ({                                    \
  168.     register long retvalue __asm__("d0");                \
  169.     long _a = (long)(a);                        \
  170.     long _b = (long)(b);                        \
  171.     long _c = (long)(c);                        \
  172.     long _d = (long)(d);                        \
  173.                                     \
  174.     __asm__ volatile                        \
  175.     ("\
  176.         movl    %5,sp@-; \
  177.         movl    %4,sp@-; \
  178.         movl    %3,sp@-; \
  179.         movl    %2,sp@-; \
  180.         movw    %1,sp@-; \
  181.         trap    #14; \
  182.         lea    sp@(18),sp"                    \
  183.     : "=r"(retvalue)                        \
  184.     : "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d)            \
  185.     : "d0", "d1", "d2", "a0", "a1", "a2", "memory");        \
  186.     retvalue;                            \
  187. })
  188. #endif
  189.  
  190. #ifndef trap_14_wllllll
  191. #define trap_14_wllllll(n,a,b,c,d,e,f)                    \
  192. __extension__                                \
  193. ({                                    \
  194.     register long retvalue __asm__("d0");                \
  195.     long _a = (long)(a);                        \
  196.     long _b = (long)(b);                        \
  197.     long _c = (long)(c);                        \
  198.     long _d = (long)(d);                        \
  199.     long _e = (long)(e);                        \
  200.     long _f = (long)(f);                        \
  201.                                     \
  202.     __asm__ volatile                        \
  203.     ("\
  204.         movl    %7,sp@-; \
  205.         movl    %6,sp@-; \
  206.         movl    %5,sp@-; \
  207.         movl    %4,sp@-; \
  208.         movl    %3,sp@-; \
  209.         movl    %2,sp@-; \
  210.         movw    %1,sp@-; \
  211.         trap    #14; \
  212.         lea    sp@(26),sp"                    \
  213.     : "=r"(retvalue)                        \
  214.     : "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e), "r"(_f)    \
  215.     : "d0", "d1", "d2", "a0", "a1", "a2", "memory");        \
  216.     retvalue;                            \
  217. })
  218. #endif
  219.  
  220. #ifndef trap_14_wll
  221. #define trap_14_wll(n,a,b)                        \
  222. __extension__                                \
  223. ({                                    \
  224.     register long retvalue __asm__("d0");                \
  225.     long _a = (long)(a);                        \
  226.     long _b = (long)(b);                        \
  227.                                     \
  228.     __asm__ volatile                        \
  229.     ("\
  230.         movl    %3,sp@-; \
  231.         movl    %2,sp@-; \
  232.         movw    %1,sp@-; \
  233.         trap    #14; \
  234.         lea    sp@(10),sp"                    \
  235.     : "=r"(retvalue)                        \
  236.     : "g"(n), "r"(_a), "r"(_b)                    \
  237.     : "d0", "d1", "d2", "a0", "a1", "a2", "memory");        \
  238.     retvalue;                            \
  239. })
  240. #endif
  241.  
  242. #ifndef trap_14_wlwl
  243. #define trap_14_wlwl(n,a,b,c)                        \
  244. __extension__                                \
  245. ({                                    \
  246.     register long retvalue __asm__("d0");                \
  247.     long _a = (long)(a);                        \
  248.     short _b = (short)(b);                        \
  249.     long _c = (long)(c);                        \
  250.                                     \
  251.     __asm__ volatile                        \
  252.     ("\
  253.         movl    %4,sp@-; \
  254.         movw    %3,sp@-; \
  255.         movl    %2,sp@-; \
  256.         movw    %1,sp@-; \
  257.         trap    #14; \
  258.         lea    sp@(12),sp"                    \
  259.     : "=r"(retvalue)                        \
  260.     : "g"(n), "r"(_a), "r"(_b), "r"(_c)                \
  261.     : "d0", "d1", "d2", "a0", "a1", "a2", "memory");        \
  262.     retvalue;                            \
  263. })
  264. #endif
  265.  
  266. #endif /* __SOZOBON__ */
  267. #endif /* __C68__ */
  268. #endif /* __LATTICE__ */
  269.  
  270. /*
  271.  * Video
  272.  */
  273.  
  274. /* Video mode codes */
  275.  
  276. #define    VERTFLAG    0x100    /* double-line on VGA, interlace on ST/TV */
  277. #define    STMODES        0x080    /* ST compatible */
  278. #define    OVERSCAN    0x040    /* Multiply X&Y rez by 1.2, ignored on VGA */
  279. #define    PAL        0x020    /* PAL if set, else NTSC */
  280. #define    VGA        0x010    /* VGA if set, else TV mode */
  281. #define    COL80        0x008    /* 80 column if set, else 40 column */
  282. #define    NUMCOLS        7    /* Mask for number of bits per pixel */
  283. #define    BPS16        4
  284. #define    BPS8        3
  285. #define    BPS4        2
  286. #define    BPS2        1
  287. #define    BPS1        0
  288.  
  289. /* Montype return values */
  290. enum montypes {STmono=0, STcolor, VGAcolor, TVcolor};
  291.  
  292. /* VsetSync flags - 0=internal, 1=external */
  293.  
  294. #define    VID_CLOCK    1
  295. #define    VID_VSYNC    2
  296. #define    VID_HSYNC    4
  297.  
  298. #undef Setscreen
  299.  
  300. #ifdef __LATTICE__
  301.  
  302. #define Setscreen(a, b, c, d) _sfppss(5, a, b, c, d)
  303. #define Vsetmode(a) _sfs(88, a)
  304. #define Montype() _sfv(89)
  305. #define VsetSync(a) _vfs(90)
  306. #define VgetSize(a) _lfs(91)
  307. #define VsetRGB(a, b, c) _vfssR(93, a, b, c)
  308. #define VgetRGB(a, b, c) _vfssr(94, a, b, c)
  309. #define VsetMask(a, b) _vfss(150, a, b)
  310.  
  311. #else /* !__LATTICE__ */
  312.  
  313.  
  314. #define Setscreen(lscrn,pscrn,rez,mode)                    \
  315.     (short)trap_14_wllww((short)5,(long)(lscrn),(long)(pscrn),    \
  316.         (short)(rez),(short)(mode))
  317. #define Vsetmode(mode)                            \
  318.     (short)trap_14_ww((short)88,(short)(mode))
  319. #define Montype()                            \
  320.     (short)trap_14_w((short)89)
  321. #define    VgetSize(mode)                            \
  322.     (long)trap_14_ww((short)91,(short)(mode))
  323. #define    VsetSync(ext)                            \
  324.     (void)trap_14_ww((short)90,(short)(ext))
  325. #define VsetRGB(index,count,array)                    \
  326.     (void)trap_14_wwwl((short)93,(short)(index),(short)(count),    \
  327.         (long *)(array))
  328. #define VgetRGB(index,count,array)                    \
  329.     (void)trap_14_wwwl((short)94,(short)(index),(short)(count),    \
  330.         (long *)(array))
  331. #define VsetMask(andmask,ormask)                    \
  332.     (short)trap_14_www((short)150,(short)(andmask),(short)(ormask))
  333.  
  334. #endif /* __LATTICE__ */
  335.  
  336. /*
  337.  * Sound
  338.  */
  339.  
  340. /* _SND cookie values */
  341.  
  342. #define SND_PSG        0x01    /* Yamaha PSG */
  343. #define    SND_8BIT    0x02    /* 8 bit DMA stereo */
  344. #define    SND_16BIT    0x04    /* 16 bit CODEC */
  345. #define    SND_DSP        0x08    /* DSP */
  346. #define    SND_MATRIX    0x10    /* Connection Matrix */
  347.  
  348. /* XXX Docs say Falcon shows 0x3f. What does bit 0x20 mean ??? */
  349.  
  350. /*
  351.  * Sound data memory layout - samples are all signed values
  352.  *
  353.  *                 (each char = 1 byte, 2 chars = 1 word)
  354.  * 1 16 bit stereo track:    LLRRLLRRLLRRLLRR
  355.  * 1 8 bit stereo track:    LRLRLRLR  
  356.  * 2 16 bit stereo tracks:    L0R0L1R1L0R0L1R1
  357.  *  etc...
  358.  */
  359.  
  360. /* Setbuffer regions */
  361.  
  362. #define    SR_PLAY        0    /* Set playback registers */
  363. #define    SR_RECORD    1    /* Set record registers */
  364.  
  365. /* Soundcmd Modes */
  366.  
  367. #define LTATTEN        0    /* Left-channel output attenuation */
  368. #define    RTATTEN        1    /* Right channel atten */
  369. #define    LTGAIN        2    /* Left input gain */
  370. #define    RTGAIN        3    /* Right channel gain */
  371.     /* gain and attenuation in 1.5db units, 0x00V0, V:0-15 */
  372. #define    ADDERIN        4    /* Select inputs to adder 0=off, 1=on */
  373. #define    ADCIN        1    /* Input from ADC */
  374. #define    MATIN        2    /* Input from connection matrix */
  375. #define    ADCINPUT    5    /* Select input to ADC, 0=mic, 1=PSG */
  376. #define    ADCRT        1    /* Right channel input */
  377. #define    ADCLT        2    /* Left input */
  378. #define    SETPRESCALE    6    /* Set TT compatibility prescaler */
  379. #define    PREMUTE        0    /* was /1280, now is invalid, mutes */
  380. #define    PRE1280        PREMUTE
  381. #define    PRE640        1    /* divide by 640 */
  382. #define    PRE320        2    /* / 320 */
  383. #define    PRE160        3    /* / 160 */
  384.  
  385. /* Record/Playback modes */
  386.  
  387. #define    STEREO8        0    /* 8 bit stereo */
  388. #define    STEREO16    1    /* 16 bit stereo */
  389. #define    MONO8        2    /* 8 bit mono */
  390.  
  391. /* Record/Playback tracks range from 0 to 3 */
  392.  
  393. /* XXX Doc for Settracks could be clearer. Can we individually set, e.g.,
  394.    tracks 0 & 2 for playback, or must track selections be contiguous? */
  395.  
  396. /* Sound buffer interrupts */
  397.     /* sources */
  398. #define    SI_TIMERA    0    /* Timer A interrupt */
  399. #define    SI_MFPI7    1    /* MFP interrupt 7 */
  400.     /* causes */
  401. #define    SI_NONE        0    /* No interrupts */
  402. #define    SI_PLAY        1    /* Intr at end of play buffer */
  403. #define    SI_RECORD    2    /* Intr at end of record buffer */
  404. #define    SI_BOTH        3    /* Interrupt for either play or record */
  405.  
  406. /* Buffoper flags */
  407.  
  408. #define    SB_PLA_ENA    1    /* Play enable */
  409. #define    SB_PLA_RPT    2    /* Play repeat (continuous loop mode) */
  410. #define    SB_REC_ENA    4    /* Record enable */
  411. #define SB_REC_RPT    8    /* Record repeat */
  412.  
  413. /* Dsptristate - 0=tristate, 1=enable */
  414.  
  415. /* Gpio modes */
  416.  
  417. #define    GPIO_SET    0    /* Set I/O direction, 0=in, 1=out */
  418. #define    GPIO_READ    1    /* Read bits - only 3 bits on gpio */
  419. #define    GPIO_WRITE    2    /* Write gpio data bits */
  420.  
  421. /* Devconnect (connection matrix) source devices */
  422.  
  423. #define    DMAPLAY        0    /* DMA playback */
  424. #define    DSPXMIT        1    /* DSP transmit */
  425. #define    EXTINP        2    /* External input */
  426. #define    ADC        3    /* Microphone/PSG, see Soundcmd(ADCINPUT) */
  427.  
  428. /* Devconnect destination devices, bitmapped */
  429.  
  430. #define    DMAREC        1    /* DMA record */
  431. #define    DSPRECV        2    /* DSP receive */
  432. #define    EXTOUT        4    /* External output */
  433. #define    DAC        8    /* Headphone, internal speaker, monitor */
  434.  
  435. /* Devconnect clock sources */
  436.  
  437. #define    CLK25M        0    /* Internal 25.175 MHz clock */
  438. #define    CLKEXT        1    /* External clock */
  439. #define    CLK32M        2    /* Internal 32 MHz. Invalid for CODEC */
  440.  
  441. /* Devconnect clock prescaler values */
  442.  
  443. /* XXX Doc lists incorrect hz numbers for many of these... */
  444.  
  445. #define CLKOLD        0    /* TT compatible, see Soundcmd(SETPRESCALE) */
  446. #define    CLK50K        1    /* 49170 hz */
  447. #define    CLK33K        2    /* 32780 hz */
  448. #define    CLK25K        3    /* 24585 hz */
  449. #define    CLK20K        4    /* 19668 hz */
  450. #define    CLK16K        5    /* 16390 hz */
  451.         /*    6    (14049 hz) invalid for CODEC */
  452. #define    CLK12K        7    /* 12292 hz */
  453.         /*    8    (10927 hz) invalid for CODEC */
  454. #define    CLK10K        9    /* 9834 hz */
  455.         /*    10    (8940 hz) invalid for CODEC */
  456. #define    CLK8K        11    /* 8195 hz */
  457.         /*    12    (7565 hz) invalid */
  458.         /*    13    (7024 hz) invalid */
  459.         /*    14    (6556 hz) invalid */
  460.         /*    15    (6146 hz) invalid */
  461.  
  462. /* Sndstatus command */
  463.  
  464. #define    SND_CHECK    0    /* Check current status */
  465. #define    SND_RESET    1    /* Reset sound system */
  466.     /*
  467.      * Reset effects: DSP tristated, gain=atten=0, matrix reset,
  468.      * ADDERIN=0, Mode=STEREO8, Play=Record=Monitor tracks=0,
  469.      * interrupts disabled, buffer operation disabled.
  470.      */
  471.  
  472. /* Sndstatus status return */
  473.  
  474. #define    SS_OK        0    /* No errors */
  475. #define    SS_CTRL        1    /* Invalid control field (Data assumed OK) */
  476. #define    SS_SYNC        2    /* Invalid sync format (mutes) */
  477. #define    SS_SCLK        3    /* Serial clock out of valid range (mutes) */
  478.  
  479. #define    SS_RTCLIP    0x10    /* Right channel is clipping */
  480. #define    SS_LTCLIP    0x20    /* Left channel is clipping */
  481.  
  482. /* Structure used by Buffptr */
  483.  
  484. typedef struct SndBufPtr {
  485.     char *play;
  486.     char *record;
  487.     long reserve1;
  488.     long reserve2;
  489. } SndBufPtr;
  490.  
  491. #ifdef __LATTICE__
  492.  
  493. long _lfS(int, SndBufPtr *);
  494. #pragma inline d0=_lfS((short),)    __F_TRAP
  495.  
  496. #define Locksnd() _lfv(128)
  497. #define Unlocksnd() _lfv(129)
  498. #define Soundcmd(a, b) _lfss(130, a, b)
  499. #define Setbuffer(a, b, c) _lfspp(131, a, b, c)
  500. #define Setmode(a) _lfs(132, a)
  501. #define Settracks(a, b) _lfss(133, a, b)
  502. #define Setmontracks(a) _lfs(134, a)
  503. #define Setinterrupt(a, b) _lfss(135, a, b)
  504. #define Buffoper(a) _lfs(136, a)
  505. #define Dsptristate(a, b) _lfss(137, a, b)
  506. #define Gpio(a, b) _lfss(138, a, b)
  507. #define Devconnect(a, b, c, d, e) _lfsssss(139, a, b, c, d, e)
  508. #define Sndstatus(a) _lfs(140, a)
  509. #define Buffptr(a) _lfS(141, a)
  510.  
  511. #else /* !__LATTICE__ */
  512.  
  513. #define Locksnd()                            \
  514.     (long)trap_14_w((short)128)
  515. #define Unlocksnd()                            \
  516.     (long)trap_14_w((short)129)
  517. #define Setbuffer(region,beg,end)                    \
  518.     (long)trap_14_wwll((short)131,(short)(region),(long)(beg),(long)(end))
  519. #define Soundcmd(mode,data)                        \
  520.     (long)trap_14_www((short)130,(short)(mode),(short)(data))
  521. #define Setmode(stereo_mode)                        \
  522.     (long)trap_14_ww((short)132,(short)(stereo_mode))
  523. #define Settracks(play,rec)                        \
  524.     (long)trap_14_www((short)133,(short)(play),(short)(rec))
  525. #define Setmontracks(montrack)                        \
  526.     (long)trap_14_ww((short)134,(short)(montrack))
  527. #define Setinterrupt(src_inter,cause)                    \
  528.     (long)trap_14_www((short)135,(short)(src_inter),        \
  529.         (short)(cause))
  530. #define Buffoper(mode)                            \
  531.     (long)trap_14_ww((short)136,(short)(mode))
  532. #define Dsptristate(dspxmit,dsprec)                    \
  533.     (long)trap_14_www((short)137,(short)(dspxmit),            \
  534.         (short)(dsprec))
  535. #define Gpio(mode,data)                            \
  536.     (long)trap_14_www((short)138,(short)(mode),(short)(data))
  537. #define Devconnect(src,dst,sclk,pre,proto)                \
  538.     (long)trap_14_wwwwww((short)139,(short)(src),(short)(dst),    \
  539.         (short)(sclk),(short)(pre),(short)(proto))
  540. #define Sndstatus(reset)                        \
  541.     (long)trap_14_ww((short)140,(short)(reset))
  542. #define Buffptr(ptr)                            \
  543.     (long)trap_14_wl((short)141,(long)(ptr))
  544.  
  545. #endif /* __LATTICE__ */
  546.  
  547. /*
  548.  * DSP functions
  549.  *
  550.  * Don't even *think* of trying to use these without the manual!
  551.  */
  552.  
  553. #ifdef __LATTICE__
  554.  
  555. #define Dsp_DoBlock(a, b, c, d) _vfplpl(96, a, b, c, d)
  556. #define Dsp_BlkHandShake(a, b, c, d) _vfplpl(97, a, b, c, d)
  557. #define Dsp_BlkUnpacked(a, b, c, d) _vfplpl(98, a, b, c, d)
  558. #define Dsp_InStream(a, b, c, d) _vfplll(99, a, b, c, d)
  559. #define Dsp_OutStream(a, b, c, d) _vfplll(100, a, b, c, d)
  560. #define Dsp_IOStream(a, b, c, d, e, f) _vfppllll(101, a, b, c, d, e, f)
  561. #define Dsp_RemoveInterrupt(a) _vfs(102, a)
  562. #define Dsp_GetWordSize() _sfv(103)
  563. #define Dsp_Lock() _sfv(104)
  564. #define Dsp_Unlock() _vfv(105)
  565. #define Dsp_Available(a, b) _vfll(106, a, b)
  566. #define Dsp_Reserve(a, b) _vfll(107, a, b)
  567. #define Dsp_LoadProg(a, b, c) _sflsp(108, a, b, c)
  568. #define Dsp_ExecProg(a, b, c) _vfpls(109, a, b, c)
  569. #define Dsp_ExecBoot(a, b, c) _vfpls(110, a, b, c)
  570. #define Dsp_LodToBinary(a, b) _vflp(111, a, b)
  571. #define Dsp_TriggerHC(a) _vfs(112, a)
  572. #define Dsp_RequestUniqueAbility() _sfv(113)
  573. #define Dsp_GetProgAbility() _sfv(114)
  574. #define Dsp_FlushSubroutines() _sfv(115)
  575. #define Dsp_LoadSubroutine(a, b, c) _sfpls(116, a, b, c)
  576. #define Dsp_InqSubrAbility(a) _sfs(117, a)
  577. #define Dsp_RunSubroutine(a) _sfs(118, a)
  578. #define Dsp_Hf0(a) _sfs(119, a)
  579. #define Dsp_Hf1(a) _sfs(120, a)
  580. #define Dsp_Hf2() _sfv(121)
  581. #define Dsp_Hf3() _sfv(122)
  582. #define Dsp_BlkWords(a, b, c, d) _vfplpl(123, a, b, c, d)
  583. #define Dsp_BlkBytes(a, b, c, d) _vfplpl(124, a, b, c, d)
  584. #define Dsp_Hstat() _bfv(125)
  585. #define Dsp_SetVectors(a, b) _vfll(126, a, b)
  586. #define Dsp_MultBlocks(a, b, c, d) _vfllpp(127, a, b, c, d)
  587.  
  588. #else /* !__LATTICE__ */
  589.  
  590. #define    Dsp_DoBlock(data_in,size_in,data_out,size_out)            \
  591.     (void)trap_14_wllll((short)96,(long)(data_in),(long)(size_in),    \
  592.         (long)(data_out),(long)(size_out))
  593. #define    Dsp_BlkHandShake(data_in,size_in,data_out,size_out)        \
  594.     (void)trap_14_wllll((short)97,(long)(data_in),(long)(size_in),    \
  595.         (long)(data_out),(long)(size_out))
  596. #define    Dsp_BlkUnpacked(data_in,size_in,data_out,size_out)        \
  597.     (void)trap_14_wllll((short)98,(long)(data_in),(long)(size_in),    \
  598.         (long)(data_out),(long)(size_out))
  599. #define    Dsp_BlkWords(data_in,size_in,data_out,size_out)            \
  600.     (void)trap_14_wllll((short)123,(long)(data_in),(long)(size_in),    \
  601.         (long)(data_out),(long)(size_out))
  602. #define    Dsp_BlkBytes(data_in,size_in,data_out,size_out)            \
  603.     (void)trap_14_wllll((short)124,(long)(data_in),(long)(size_in),    \
  604.         (long)(data_out),(long)(size_out))
  605. #define    Dsp_MultBlocks(numsend,numrecv,sendblks,recvblks)        \
  606.     (void)trap_14_wllll((short)127,(long)(numsend),(long)(numrecv),    \
  607.         (long)(sendblks),(long)(recvblks))
  608. #define    Dsp_InStream(data_in,blksiz,numblks,blksdone)            \
  609.     (void)trap_14_wllll((short)99,(long)(data_in),(long)(blksiz),    \
  610.         (long)(numblks),(long)(blksdone))
  611. #define    Dsp_OutStream(data_out,blksiz,numblks,blksdone)            \
  612.     (void)trap_14_wllll((short)100,(long)(data_out),(long)(blksiz),    \
  613.         (long)(numblks),(long)(blksdone))
  614. #define    Dsp_IOStream(data_in,data_out,blkisiz,blkosiz,numblks,blksdone)    \
  615.     (void)trap_14_wllllll((short)101,(long)(data_in),(long)(data_out),\
  616.         (long)(blkisiz),(long)(blkosiz),(long)(numblks),    \
  617.         (long)(blksdone))
  618. #define    Dsp_SetVectors(rcvr,xmtr)                    \
  619.     (void)trap_14_wll((short)126,(long)(rcvr),(long)(xmtr))
  620. #define    Dsp_RemoveInterrupts(mask)                    \
  621.     (void)trap_14_ww((short)102,(short)(mask))
  622. #define    Dsp_GetWordSize()    (short)trap_14_w((short)103)
  623. #define    Dsp_Lock()        (short)trap_14_w((short)104)
  624. #define    Dsp_Unlock()        (void)trap_14_w((short)105)
  625. #define    Dsp_Available(xmem,ymem)                    \
  626.     (void)trap_14_wll((short)106,(long)(xmem),(long)(ymem))
  627. #define    Dsp_Reserve(xmem,ymem)                        \
  628.     (short)trap_14_wll((short)107,(long)(xmem),(long)(ymem))
  629. #define    Dsp_LoadProg(file,ability,buffer)                \
  630.     (short)trap_14_wlwl((short)108,(long)(file),(short)(ability),    \
  631.         (long)(buffer))
  632. #define    Dsp_ExecProg(codeptr,codesiz,ability)                \
  633.     (void)trap_14_wllw((short)109,(long)(codeptr),(long)(codesiz),    \
  634.         (short)(ability))
  635. #define    Dsp_ExecBoot(codeptr,codesiz,ability)                \
  636.     (void)trap_14_wllw((short)110,(long)(codeptr),(long)(codesiz),    \
  637.         (short)(ability))
  638. #define    Dsp_LodToBinary(file,codeptr)                    \
  639.     (long)trap_14_wll((short)111,(long)(file),(long)(codeptr))
  640. #define    Dsp_TriggerHC(vector)                        \
  641.     (void)trap_14_ww((short)112,(short)(vector))
  642. #define    Dsp_RequestUniqueAbility()    (short)trap_14_w((short)113)
  643. #define    Dsp_GetProgAbility()        (short)trap_14_w((short)114)
  644. #define    Dsp_FlushSubroutines()        (void)trap_14_w((short)115)
  645. #define    Dsp_LoadSubroutine(ptr,siz,ability)                \
  646.     (short)trap_14_wllw((short)116,(long)(ptr),(long)(siz),        \
  647.         (short)(ability))
  648. #define    Dsp_InqSubrAbility(ability)                    \
  649.     (short)trap_14_ww((short)117,(short)(ability))
  650. #define    Dsp_RunSubroutine(handle)                    \
  651.     (short)trap_14_ww((short)118,(short)(handle))
  652. #define    Dsp_Hf0(flag)                            \
  653.     (short)trap_14_ww((short)119,(short)(flag))
  654. #define    Dsp_Hf1(flag)                            \
  655.     (short)trap_14_ww((short)120,(short)(flag))
  656. #define    Dsp_Hf2()        (short)trap_14_w((short)121)
  657. #define    Dsp_Hf3()        (short)trap_14_w((short)122)
  658. #define    Dsp_HStat()        (char)trap_14_w((short)125)
  659.  
  660. #endif /* __LATTICE__ */
  661.  
  662. #endif /* _FALCON_H */
  663.